﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace patchPack
{	
	class LogicMod
	{
		const string PatchDirName = @"\patch";
		const string fileInfoName = @"\fileInfo.json";
		const string scriptDirName = @"\scripts"; 

		public static void WriteContentToInfoFile(string basepPath, string content)
		{
			string fullPath = basepPath + PatchDirName;
			FileHandle.WriteFile(fullPath + fileInfoName, content);
		}

		//创建补丁文件目录
		public static void CreatePatchDir(string basepPath)
		{
			string fullPath = basepPath + PatchDirName;
			FileHandle.CreateDir(fullPath);
			FileHandle.CreateDir(fullPath + scriptDirName);
		
			FileHandle.CreateFile(fullPath + fileInfoName);
			WriteContentToInfoFile(basepPath, "");
		}

		public static void CopyAssetsToPatch(string sourPath, string fileName, string orgName)
		{
			string destFile = StringMod.GetParentPath(sourPath) + PatchDirName;
			File.Copy(sourPath + "\\" + orgName, destFile + "\\" + fileName);
		}

		public static void CopyScriptsToPatch(string sourPath, string fileName, string content)
		{
			string destFile = StringMod.GetParentPath(sourPath) + PatchDirName + scriptDirName + "/" + fileName;
			FileHandle.WriteFile(destFile, content);
		}



	}
}